/**
 * TimePeriod.java
 * Version: 1.0
 * Created in 07/08/2013
 * Created by: Gerson Groth
 * 
 * Copyright
 */
package activities.base.utils;


/**
 * The Enum TimePeriod.
 */
public enum TimePeriod {

	/** The Last 30 days. */
	LAST_30_DAYS(
			"Last 30 Days",
			"previousDays=30"),

	/** The Last 24 hours. */
	LAST_24_HOURS(
			"Last 24 Hours",
			"previousDays=1"),

	/** The Last 7 days. */
	LAST_7_DAYS(
			"Last 7 Days",
			"previousDays=7"),

	/** The Last 365 days. */
	LAST_365_DAYS(
			"Last 365 Days",
			"previousDays=365"),

	/** The custom dates. */
	CUSTOM_DATES(
			"Last 365 Days",
			"customTimestamp");

	/** The time. */
	private String time;

	/** The value. */
	private String value;

	/**
	 * Instantiates a new time period.
	 * 
	 * @param time
	 *            the time
	 * @param value
	 *            the value
	 */
	TimePeriod(String time, String value) {
		this.time = time;
		this.value = value;
	}

	/**
	 * Gets the time.
	 * 
	 * @return the time
	 */
	public String getTime() {
		return time;
	}

	/**
	 * Sets the time.
	 * 
	 * @param time
	 *            the new time
	 */
	public void setTime(String time) {
		this.time = time;
	}

	/**
	 * Gets the value.
	 * 
	 * @return the value
	 */
	public String getValue() {
		return value;
	}

	/**
	 * Sets the value.
	 * 
	 * @param value
	 *            the new value
	 */
	public void setValue(String value) {
		this.value = value;
	}

	/**
	 * Gets the time.
	 * 
	 * @param name
	 *            the name
	 * @return the time
	 */
	public static TimePeriod getTime(String name) {
		for (TimePeriod time : TimePeriod.values()) {
			if (time.getTime().equals(name))
				return time;
		}
		return null;
	}

}
